package com.chenl.provider.题目;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class VolatileVisbilityTest {
    private static boolean initFlag = false;

    public static void main(String[] args) throws Exception {
        List<Integer> objects = new ArrayList<>();
        objects.add(1);
        objects.add(2);
        objects.add(3);
        System.out.println(objects);
        Collections.reverse(objects);
        System.out.println(objects);
//        List<Object> objects1 = Collections.emptyList();
//        objects1.add(1);
//        System.out.println(objects1);
/*        new Thread(()->{
//            System.out.println("waiting...");
            while (!initFlag){

            }
            System.out.println("Success~~~~");
        }).start();
        Thread.sleep(4000);
        new Thread(VolatileVisbilityTest::prepareData).start();;*/
    }

    private static void prepareData() {
        System.out.println("prepareData start....");
        initFlag = true;
        System.out.println("prepareData end....");
    }
}
